package com.lablzh.gdxy.repository;

import com.lablzh.gdxy.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

public interface UserRepository extends JpaRepository<User,Integer> {
    User findAllByUsername(String username);
    @Modifying
    @Transactional
    @Query("update User set password=?2 where username=?1")
    void  updatePasswordByUsername(String username,String password);

    @Transactional
    void deleteByUsername(String teacherUsername);

}
